--
-- PostgreSQL database dump
--

-- Dumped from database version 9.0.3
-- Dumped by pg_dump version 9.0.3
-- Started on 2011-04-30 14:22:12

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 349 (class 2612 OID 11574)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 1541 (class 1259 OID 18029)
-- Dependencies: 6
-- Name: tb_cargo; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_cargo (
    id_cargo integer NOT NULL,
    tp_perfil character(60) NOT NULL
);


ALTER TABLE public.tb_cargo OWNER TO postgres;

--
-- TOC entry 1542 (class 1259 OID 18032)
-- Dependencies: 1541 6
-- Name: tb_cargo_id_cargo_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE tb_cargo_id_cargo_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.tb_cargo_id_cargo_seq OWNER TO postgres;

--
-- TOC entry 1908 (class 0 OID 0)
-- Dependencies: 1542
-- Name: tb_cargo_id_cargo_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE tb_cargo_id_cargo_seq OWNED BY tb_cargo.id_cargo;


--
-- TOC entry 1567 (class 1259 OID 26624)
-- Dependencies: 6
-- Name: tb_endereco; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_endereco (
    id_endereco integer NOT NULL,
    endereco character(255) NOT NULL,
    nu_residencia character(60) NOT NULL,
    complemento character(255),
    bairro character(255) NOT NULL,
    cidade character(255) NOT NULL,
    cep character(9) NOT NULL,
    id_uf integer NOT NULL
);


ALTER TABLE public.tb_endereco OWNER TO postgres;

--
-- TOC entry 1566 (class 1259 OID 26622)
-- Dependencies: 6 1567
-- Name: tb_endereco_id_endereco_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE tb_endereco_id_endereco_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.tb_endereco_id_endereco_seq OWNER TO postgres;

--
-- TOC entry 1909 (class 0 OID 0)
-- Dependencies: 1566
-- Name: tb_endereco_id_endereco_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE tb_endereco_id_endereco_seq OWNED BY tb_endereco.id_endereco;


--
-- TOC entry 1543 (class 1259 OID 18053)
-- Dependencies: 6
-- Name: tb_funcionario; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_funcionario (
    id_funcionario integer NOT NULL,
    id_cargo integer,
    nu_pis_pasep character(11),
    nu_ctps character(11)
);


ALTER TABLE public.tb_funcionario OWNER TO postgres;

--
-- TOC entry 1544 (class 1259 OID 18056)
-- Dependencies: 6
-- Name: tb_marca; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_marca (
    id_marca integer NOT NULL,
    nm_marca character(60) NOT NULL
);


ALTER TABLE public.tb_marca OWNER TO postgres;

--
-- TOC entry 1545 (class 1259 OID 18059)
-- Dependencies: 6 1544
-- Name: tb_marca_id_marca_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE tb_marca_id_marca_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.tb_marca_id_marca_seq OWNER TO postgres;

--
-- TOC entry 1910 (class 0 OID 0)
-- Dependencies: 1545
-- Name: tb_marca_id_marca_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE tb_marca_id_marca_seq OWNED BY tb_marca.id_marca;


--
-- TOC entry 1546 (class 1259 OID 18074)
-- Dependencies: 6
-- Name: tb_ordem_servico; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_ordem_servico (
    id_ordem_servico integer NOT NULL,
    id_tp_pagamento integer,
    id_tp_servico integer,
    id_usuario integer,
    id_funcionario integer,
    data date,
    observacao text,
    pagamento boolean NOT NULL
);


ALTER TABLE public.tb_ordem_servico OWNER TO postgres;

--
-- TOC entry 1547 (class 1259 OID 18080)
-- Dependencies: 1546 6
-- Name: tb_ordem_servico_id_ordem_servico_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE tb_ordem_servico_id_ordem_servico_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.tb_ordem_servico_id_ordem_servico_seq OWNER TO postgres;

--
-- TOC entry 1911 (class 0 OID 0)
-- Dependencies: 1547
-- Name: tb_ordem_servico_id_ordem_servico_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE tb_ordem_servico_id_ordem_servico_seq OWNED BY tb_ordem_servico.id_ordem_servico;


--
-- TOC entry 1548 (class 1259 OID 18082)
-- Dependencies: 6
-- Name: tb_preco; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_preco (
    id_preco integer NOT NULL,
    preco double precision NOT NULL,
    dt_preco date,
    status boolean
);


ALTER TABLE public.tb_preco OWNER TO postgres;

--
-- TOC entry 1549 (class 1259 OID 18085)
-- Dependencies: 6 1548
-- Name: tb_preco_id_preco_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE tb_preco_id_preco_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.tb_preco_id_preco_seq OWNER TO postgres;

--
-- TOC entry 1912 (class 0 OID 0)
-- Dependencies: 1549
-- Name: tb_preco_id_preco_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE tb_preco_id_preco_seq OWNED BY tb_preco.id_preco;


--
-- TOC entry 1550 (class 1259 OID 18097)
-- Dependencies: 6
-- Name: tb_recebimento_caixa; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_recebimento_caixa (
    id_rc_caixa integer NOT NULL,
    id_ordem_servico integer,
    vr_caixa numeric(18,2) NOT NULL
);


ALTER TABLE public.tb_recebimento_caixa OWNER TO postgres;

--
-- TOC entry 1551 (class 1259 OID 18100)
-- Dependencies: 6 1550
-- Name: tb_recebimento_caixa_id_rc_caixa_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE tb_recebimento_caixa_id_rc_caixa_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.tb_recebimento_caixa_id_rc_caixa_seq OWNER TO postgres;

--
-- TOC entry 1913 (class 0 OID 0)
-- Dependencies: 1551
-- Name: tb_recebimento_caixa_id_rc_caixa_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE tb_recebimento_caixa_id_rc_caixa_seq OWNED BY tb_recebimento_caixa.id_rc_caixa;


--
-- TOC entry 1552 (class 1259 OID 18107)
-- Dependencies: 1850 6
-- Name: tb_telefone; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_telefone (
    id_telefone integer NOT NULL,
    id_tp_telefone integer NOT NULL,
    id_usuario integer NOT NULL,
    nu_ddd integer NOT NULL,
    nu_telefone character(9) NOT NULL,
    status boolean DEFAULT true NOT NULL
);


ALTER TABLE public.tb_telefone OWNER TO postgres;

--
-- TOC entry 1553 (class 1259 OID 18111)
-- Dependencies: 6 1552
-- Name: tb_telefone_id_telefone_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE tb_telefone_id_telefone_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.tb_telefone_id_telefone_seq OWNER TO postgres;

--
-- TOC entry 1914 (class 0 OID 0)
-- Dependencies: 1553
-- Name: tb_telefone_id_telefone_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE tb_telefone_id_telefone_seq OWNED BY tb_telefone.id_telefone;


--
-- TOC entry 1554 (class 1259 OID 18113)
-- Dependencies: 6
-- Name: tb_tipo_servico; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_tipo_servico (
    id_tp_servico integer NOT NULL,
    nu_preco integer,
    tp_servico text NOT NULL,
    status boolean
);


ALTER TABLE public.tb_tipo_servico OWNER TO postgres;

--
-- TOC entry 1555 (class 1259 OID 18119)
-- Dependencies: 1554 6
-- Name: tb_tipo_servico_id_tp_servico_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE tb_tipo_servico_id_tp_servico_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.tb_tipo_servico_id_tp_servico_seq OWNER TO postgres;

--
-- TOC entry 1915 (class 0 OID 0)
-- Dependencies: 1555
-- Name: tb_tipo_servico_id_tp_servico_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE tb_tipo_servico_id_tp_servico_seq OWNED BY tb_tipo_servico.id_tp_servico;


--
-- TOC entry 1556 (class 1259 OID 18121)
-- Dependencies: 6
-- Name: tb_tp_pagamento; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_tp_pagamento (
    id_tp_pagamento integer NOT NULL,
    tp_pagamento character(60) NOT NULL
);


ALTER TABLE public.tb_tp_pagamento OWNER TO postgres;

--
-- TOC entry 1557 (class 1259 OID 18124)
-- Dependencies: 6 1556
-- Name: tb_tp_pagamento_id_tp_pagamento_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE tb_tp_pagamento_id_tp_pagamento_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.tb_tp_pagamento_id_tp_pagamento_seq OWNER TO postgres;

--
-- TOC entry 1916 (class 0 OID 0)
-- Dependencies: 1557
-- Name: tb_tp_pagamento_id_tp_pagamento_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE tb_tp_pagamento_id_tp_pagamento_seq OWNED BY tb_tp_pagamento.id_tp_pagamento;


--
-- TOC entry 1558 (class 1259 OID 18126)
-- Dependencies: 6
-- Name: tb_tp_telefone; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_tp_telefone (
    id_tp_telefone integer NOT NULL,
    nm_tipo character(40) NOT NULL
);


ALTER TABLE public.tb_tp_telefone OWNER TO postgres;

--
-- TOC entry 1559 (class 1259 OID 18129)
-- Dependencies: 6 1558
-- Name: tb_tp_telefone_id_tp_telefone_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE tb_tp_telefone_id_tp_telefone_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.tb_tp_telefone_id_tp_telefone_seq OWNER TO postgres;

--
-- TOC entry 1917 (class 0 OID 0)
-- Dependencies: 1559
-- Name: tb_tp_telefone_id_tp_telefone_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE tb_tp_telefone_id_tp_telefone_seq OWNED BY tb_tp_telefone.id_tp_telefone;


--
-- TOC entry 1565 (class 1259 OID 26616)
-- Dependencies: 6
-- Name: tb_uf; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_uf (
    id_uf integer NOT NULL,
    nm_uf character(60) NOT NULL,
    sg_uf character(2) NOT NULL
);


ALTER TABLE public.tb_uf OWNER TO postgres;

--
-- TOC entry 1564 (class 1259 OID 26614)
-- Dependencies: 6 1565
-- Name: tb_uf_id_uf_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE tb_uf_id_uf_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.tb_uf_id_uf_seq OWNER TO postgres;

--
-- TOC entry 1918 (class 0 OID 0)
-- Dependencies: 1564
-- Name: tb_uf_id_uf_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE tb_uf_id_uf_seq OWNED BY tb_uf.id_uf;


--
-- TOC entry 1560 (class 1259 OID 18134)
-- Dependencies: 1856 6
-- Name: tb_usuario; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_usuario (
    id_usuario integer NOT NULL,
    nm_usuario character(60) NOT NULL,
    nu_cpf character(11) NOT NULL,
    ds_email character(60) NOT NULL,
    cd_senha character(255) NOT NULL,
    dt_cadastro date NOT NULL,
    id_endereco integer,
    status boolean DEFAULT true NOT NULL
);


ALTER TABLE public.tb_usuario OWNER TO postgres;

--
-- TOC entry 1561 (class 1259 OID 18137)
-- Dependencies: 6 1560
-- Name: tb_usuario_id_usuario_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE tb_usuario_id_usuario_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.tb_usuario_id_usuario_seq OWNER TO postgres;

--
-- TOC entry 1919 (class 0 OID 0)
-- Dependencies: 1561
-- Name: tb_usuario_id_usuario_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE tb_usuario_id_usuario_seq OWNED BY tb_usuario.id_usuario;


--
-- TOC entry 1562 (class 1259 OID 18139)
-- Dependencies: 1858 6
-- Name: tb_veiculo_cliente; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE tb_veiculo_cliente (
    id_veiculo_cliente integer NOT NULL,
    id_usuario integer,
    placa_veiculo character(80) NOT NULL,
    cor character(60) NOT NULL,
    modelo_veiculo character(60) NOT NULL,
    id_marca integer NOT NULL,
    status boolean DEFAULT true NOT NULL
);


ALTER TABLE public.tb_veiculo_cliente OWNER TO postgres;

--
-- TOC entry 1563 (class 1259 OID 18142)
-- Dependencies: 6 1562
-- Name: tb_veiculo_cliente_id_veiculo_cliente_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE tb_veiculo_cliente_id_veiculo_cliente_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.tb_veiculo_cliente_id_veiculo_cliente_seq OWNER TO postgres;

--
-- TOC entry 1920 (class 0 OID 0)
-- Dependencies: 1563
-- Name: tb_veiculo_cliente_id_veiculo_cliente_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE tb_veiculo_cliente_id_veiculo_cliente_seq OWNED BY tb_veiculo_cliente.id_veiculo_cliente;


--
-- TOC entry 1845 (class 2604 OID 18145)
-- Dependencies: 1542 1541
-- Name: id_cargo; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE tb_cargo ALTER COLUMN id_cargo SET DEFAULT nextval('tb_cargo_id_cargo_seq'::regclass);


--
-- TOC entry 1860 (class 2604 OID 26627)
-- Dependencies: 1567 1566 1567
-- Name: id_endereco; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE tb_endereco ALTER COLUMN id_endereco SET DEFAULT nextval('tb_endereco_id_endereco_seq'::regclass);


--
-- TOC entry 1846 (class 2604 OID 18149)
-- Dependencies: 1545 1544
-- Name: id_marca; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE tb_marca ALTER COLUMN id_marca SET DEFAULT nextval('tb_marca_id_marca_seq'::regclass);


--
-- TOC entry 1847 (class 2604 OID 18152)
-- Dependencies: 1547 1546
-- Name: id_ordem_servico; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE tb_ordem_servico ALTER COLUMN id_ordem_servico SET DEFAULT nextval('tb_ordem_servico_id_ordem_servico_seq'::regclass);


--
-- TOC entry 1848 (class 2604 OID 18153)
-- Dependencies: 1549 1548
-- Name: id_preco; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE tb_preco ALTER COLUMN id_preco SET DEFAULT nextval('tb_preco_id_preco_seq'::regclass);


--
-- TOC entry 1849 (class 2604 OID 18156)
-- Dependencies: 1551 1550
-- Name: id_rc_caixa; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE tb_recebimento_caixa ALTER COLUMN id_rc_caixa SET DEFAULT nextval('tb_recebimento_caixa_id_rc_caixa_seq'::regclass);


--
-- TOC entry 1851 (class 2604 OID 18158)
-- Dependencies: 1553 1552
-- Name: id_telefone; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE tb_telefone ALTER COLUMN id_telefone SET DEFAULT nextval('tb_telefone_id_telefone_seq'::regclass);


--
-- TOC entry 1852 (class 2604 OID 18159)
-- Dependencies: 1555 1554
-- Name: id_tp_servico; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE tb_tipo_servico ALTER COLUMN id_tp_servico SET DEFAULT nextval('tb_tipo_servico_id_tp_servico_seq'::regclass);


--
-- TOC entry 1853 (class 2604 OID 18160)
-- Dependencies: 1557 1556
-- Name: id_tp_pagamento; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE tb_tp_pagamento ALTER COLUMN id_tp_pagamento SET DEFAULT nextval('tb_tp_pagamento_id_tp_pagamento_seq'::regclass);


--
-- TOC entry 1854 (class 2604 OID 18161)
-- Dependencies: 1559 1558
-- Name: id_tp_telefone; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE tb_tp_telefone ALTER COLUMN id_tp_telefone SET DEFAULT nextval('tb_tp_telefone_id_tp_telefone_seq'::regclass);


--
-- TOC entry 1859 (class 2604 OID 26619)
-- Dependencies: 1565 1564 1565
-- Name: id_uf; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE tb_uf ALTER COLUMN id_uf SET DEFAULT nextval('tb_uf_id_uf_seq'::regclass);


--
-- TOC entry 1855 (class 2604 OID 18162)
-- Dependencies: 1561 1560
-- Name: id_usuario; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE tb_usuario ALTER COLUMN id_usuario SET DEFAULT nextval('tb_usuario_id_usuario_seq'::regclass);


--
-- TOC entry 1857 (class 2604 OID 18163)
-- Dependencies: 1563 1562
-- Name: id_veiculo_cliente; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE tb_veiculo_cliente ALTER COLUMN id_veiculo_cliente SET DEFAULT nextval('tb_veiculo_cliente_id_veiculo_cliente_seq'::regclass);


--
-- TOC entry 1862 (class 2606 OID 18167)
-- Dependencies: 1541 1541
-- Name: tb_cargo_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_cargo
    ADD CONSTRAINT tb_cargo_pkey PRIMARY KEY (id_cargo);


--
-- TOC entry 1888 (class 2606 OID 26649)
-- Dependencies: 1567 1567
-- Name: tb_endereco_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_endereco
    ADD CONSTRAINT tb_endereco_pkey PRIMARY KEY (id_endereco);


--
-- TOC entry 1864 (class 2606 OID 18175)
-- Dependencies: 1543 1543
-- Name: tb_funcionario_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_funcionario
    ADD CONSTRAINT tb_funcionario_pkey PRIMARY KEY (id_funcionario);


--
-- TOC entry 1866 (class 2606 OID 18177)
-- Dependencies: 1544 1544
-- Name: tb_marca_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_marca
    ADD CONSTRAINT tb_marca_pkey PRIMARY KEY (id_marca);


--
-- TOC entry 1868 (class 2606 OID 18183)
-- Dependencies: 1546 1546
-- Name: tb_ordem_servico_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_ordem_servico
    ADD CONSTRAINT tb_ordem_servico_pkey PRIMARY KEY (id_ordem_servico);


--
-- TOC entry 1870 (class 2606 OID 18185)
-- Dependencies: 1548 1548
-- Name: tb_preco_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_preco
    ADD CONSTRAINT tb_preco_pkey PRIMARY KEY (id_preco);


--
-- TOC entry 1872 (class 2606 OID 18191)
-- Dependencies: 1550 1550
-- Name: tb_recebimento_caixa_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_recebimento_caixa
    ADD CONSTRAINT tb_recebimento_caixa_pkey PRIMARY KEY (id_rc_caixa);


--
-- TOC entry 1874 (class 2606 OID 18195)
-- Dependencies: 1552 1552
-- Name: tb_telefone_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_telefone
    ADD CONSTRAINT tb_telefone_pkey PRIMARY KEY (id_telefone);


--
-- TOC entry 1876 (class 2606 OID 18197)
-- Dependencies: 1554 1554
-- Name: tb_tipo_servico_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_tipo_servico
    ADD CONSTRAINT tb_tipo_servico_pkey PRIMARY KEY (id_tp_servico);


--
-- TOC entry 1878 (class 2606 OID 18199)
-- Dependencies: 1556 1556
-- Name: tb_tp_pagamento_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_tp_pagamento
    ADD CONSTRAINT tb_tp_pagamento_pkey PRIMARY KEY (id_tp_pagamento);


--
-- TOC entry 1880 (class 2606 OID 18201)
-- Dependencies: 1558 1558
-- Name: tb_tp_telefone_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_tp_telefone
    ADD CONSTRAINT tb_tp_telefone_pkey PRIMARY KEY (id_tp_telefone);


--
-- TOC entry 1886 (class 2606 OID 26621)
-- Dependencies: 1565 1565
-- Name: tb_uf_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_uf
    ADD CONSTRAINT tb_uf_pkey PRIMARY KEY (id_uf);


--
-- TOC entry 1882 (class 2606 OID 18209)
-- Dependencies: 1560 1560
-- Name: tb_usuario_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_usuario
    ADD CONSTRAINT tb_usuario_pkey PRIMARY KEY (id_usuario);


--
-- TOC entry 1884 (class 2606 OID 18211)
-- Dependencies: 1562 1562
-- Name: tb_veiculo_cliente_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY tb_veiculo_cliente
    ADD CONSTRAINT tb_veiculo_cliente_pkey PRIMARY KEY (id_veiculo_cliente);


--
-- TOC entry 1891 (class 2606 OID 18227)
-- Dependencies: 1877 1546 1556
-- Name: fk_reference_2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_ordem_servico
    ADD CONSTRAINT fk_reference_2 FOREIGN KEY (id_tp_pagamento) REFERENCES tb_tp_pagamento(id_tp_pagamento) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- TOC entry 1896 (class 2606 OID 18237)
-- Dependencies: 1560 1881 1552
-- Name: fk_reference_22; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_telefone
    ADD CONSTRAINT fk_reference_22 FOREIGN KEY (id_usuario) REFERENCES tb_usuario(id_usuario) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- TOC entry 1892 (class 2606 OID 18247)
-- Dependencies: 1881 1546 1560
-- Name: fk_reference_24; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_ordem_servico
    ADD CONSTRAINT fk_reference_24 FOREIGN KEY (id_usuario) REFERENCES tb_usuario(id_usuario) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- TOC entry 1889 (class 2606 OID 18252)
-- Dependencies: 1861 1541 1543
-- Name: fk_reference_27; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_funcionario
    ADD CONSTRAINT fk_reference_27 FOREIGN KEY (id_cargo) REFERENCES tb_cargo(id_cargo) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- TOC entry 1900 (class 2606 OID 18257)
-- Dependencies: 1562 1881 1560
-- Name: fk_reference_28; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_veiculo_cliente
    ADD CONSTRAINT fk_reference_28 FOREIGN KEY (id_usuario) REFERENCES tb_usuario(id_usuario) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- TOC entry 1897 (class 2606 OID 18262)
-- Dependencies: 1552 1558 1879
-- Name: fk_reference_29; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_telefone
    ADD CONSTRAINT fk_reference_29 FOREIGN KEY (id_tp_telefone) REFERENCES tb_tp_telefone(id_tp_telefone) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- TOC entry 1893 (class 2606 OID 18267)
-- Dependencies: 1554 1546 1875
-- Name: fk_reference_3; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_ordem_servico
    ADD CONSTRAINT fk_reference_3 FOREIGN KEY (id_tp_servico) REFERENCES tb_tipo_servico(id_tp_servico) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- TOC entry 1894 (class 2606 OID 18282)
-- Dependencies: 1863 1543 1546
-- Name: fk_reference_32; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_ordem_servico
    ADD CONSTRAINT fk_reference_32 FOREIGN KEY (id_funcionario) REFERENCES tb_funcionario(id_funcionario) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- TOC entry 1890 (class 2606 OID 18287)
-- Dependencies: 1881 1543 1560
-- Name: fk_reference_33; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_funcionario
    ADD CONSTRAINT fk_reference_33 FOREIGN KEY (id_funcionario) REFERENCES tb_usuario(id_usuario) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- TOC entry 1898 (class 2606 OID 18297)
-- Dependencies: 1548 1869 1554
-- Name: fk_reference_4; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_tipo_servico
    ADD CONSTRAINT fk_reference_4 FOREIGN KEY (nu_preco) REFERENCES tb_preco(id_preco) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- TOC entry 1895 (class 2606 OID 18307)
-- Dependencies: 1546 1550 1867
-- Name: fk_reference_9; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_recebimento_caixa
    ADD CONSTRAINT fk_reference_9 FOREIGN KEY (id_ordem_servico) REFERENCES tb_ordem_servico(id_ordem_servico) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- TOC entry 1902 (class 2606 OID 26669)
-- Dependencies: 1567 1887 1567
-- Name: tb_endereco_id_endereco_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_endereco
    ADD CONSTRAINT tb_endereco_id_endereco_fkey FOREIGN KEY (id_endereco) REFERENCES tb_endereco(id_endereco);


--
-- TOC entry 1899 (class 2606 OID 26664)
-- Dependencies: 1887 1560 1567
-- Name: tb_usuario_id_endereco_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_usuario
    ADD CONSTRAINT tb_usuario_id_endereco_fkey FOREIGN KEY (id_endereco) REFERENCES tb_endereco(id_endereco);


--
-- TOC entry 1901 (class 2606 OID 26685)
-- Dependencies: 1562 1544 1865
-- Name: tb_veiculo_cliente_id_marca_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY tb_veiculo_cliente
    ADD CONSTRAINT tb_veiculo_cliente_id_marca_fkey FOREIGN KEY (id_marca) REFERENCES tb_marca(id_marca);


--
-- TOC entry 1907 (class 0 OID 0)
-- Dependencies: 6
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2011-04-30 14:22:13

--
-- PostgreSQL database dump complete
--

